package com.demo.money.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * user
 * @author 
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {
    /**
     * 主键id
     */
    private Integer id;

    /**
     * 0-无效,1-有效,2-待删除
     */
    private Integer valid;

    /**
     * 账号(加密）
     */
    private String nameLogin;

    /**
     * 密码(加密）
     */
    private String password;

    /**
     * 用户姓名
     */
    private String nameUser;

    /**
     * 权限控制（A-管理员,B-vip用户）
     */
    private String jurisdiction;

    private static final long serialVersionUID = 1L;


    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getValid() == null ? other.getValid() == null : this.getValid().equals(other.getValid()))
            && (this.getNameLogin() == null ? other.getNameLogin() == null : this.getNameLogin().equals(other.getNameLogin()))
            && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
            && (this.getNameUser() == null ? other.getNameUser() == null : this.getNameUser().equals(other.getNameUser()))
            && (this.getJurisdiction() == null ? other.getJurisdiction() == null : this.getJurisdiction().equals(other.getJurisdiction()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getValid() == null) ? 0 : getValid().hashCode());
        result = prime * result + ((getNameLogin() == null) ? 0 : getNameLogin().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getNameUser() == null) ? 0 : getNameUser().hashCode());
        result = prime * result + ((getJurisdiction() == null) ? 0 : getJurisdiction().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", valid=").append(valid);
        sb.append(", nameLogin=").append(nameLogin);
        sb.append(", password=").append(password);
        sb.append(", nameUser=").append(nameUser);
        sb.append(", jurisdiction=").append(jurisdiction);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}